package view.model;

import java.util.List;
import javax.swing.DefaultComboBoxModel;
import model.Animal;

/**
 *
 * @author BACQ Justine et SACRE Sauvane
 */

public class IdAnimalComboBoxModel extends DefaultComboBoxModel{
    private List<Animal> animalList; 
    
    public IdAnimalComboBoxModel(List<Animal> animalList){
        this.animalList = animalList;
        this.addElement("");
        for(Animal a : animalList){
            this.addElement(a.getIdAnimal());
        }
    }
    
    public Animal getAnimal(int index){
        if(index==0) return null;
        return animalList.get(index-1);
    }
}
